<?php
/**
 * Created by litong on Date: 2018/12/24 0024 上午 10:51
 */
class MyClassConstant{
  const constant="常量";
  function showConstant()
  {
    echo self::constant . PHP_EOL;
  }
}
echo MyClassConstant::constant.PHP_EOL;

echo "<br/>";
$classname="MyClassConstant";
echo $classname::constant . PHP_EOL; //真的的可以

echo "<br/>";
$class=new MyClassConstant();
$class->showConstant();

echo "<br/>";
echo $class::constant.PHP_EOL;
?>